/*
**  Copyright (C), CHENGDU GONGWEI TECHNOLOGY CO.,LTD.
**
**  Project:	Manager Unit v1.0
**  File:    	
**  Author: 	zhaozhuyu
**  Date:    	2017/05/20
**
**  Purpose:
**    		.
**
**  History: 
**  <author>   <time>          <version >   <desc>
*	$$Author$$
*/


#ifndef __REF_H__
#define __REF_H__


/* Include files. */
#include "cplusplus.h"
#include "debug.h"

/* Macro constant definitions. */

/* Type definitions. */

/* External variable declarations. */

/* External function declarations. */

/* Macro API definitions. */

class ref
{
public:
	ref(const char* dst, const char*  src, const char* attr, int level = 0)
	:_dst(dst), _src(src), _attr(attr), _level(level) {
		_key = _dst + _src + _attr;
	};
	virtual ~ref(){};
	static map<string, ref*> ref_map_mgr;
	static ref* findRef(string key);
	static int add(ref *r);
	static int remove(string key);

public:
	
	string _dst;
	string _src;
	string _attr;
	int _level;
	string _key;
};

int luaRelate(lua_State* L);
int luaUnRelate(lua_State* L);
int luaRelateInit(lua_State* L);


#endif

